{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. 制作国庆头像给您的亲朋好友"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "<table>\n",
    "<tr>\n",
    "   <td><img src=\"images/avatar_mat/语嫣-国庆头像.png\" title=\"语嫣-国庆头像.png\"></td> \n",
    "   <td><img src=\"images/avatar_mat/杨过-国庆头像.png\" title=\"杨过-国庆头像.png\"></td> \n",
    "   <td><img src=\"images/avatar_mat/刘备-国庆头像.png\" title=\"刘备-国庆头像.png\"></td> \n",
    "   <td><img src=\"images/avatar_mat/关羽-国庆头像.png\" title=\"关羽-国庆头像.png\"></td> \n",
    " </tr>\n",
    "</table>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# 2. 图片素材\n",
    "\n",
    "## 2.1 部分头像素材（更多素材在网盘）\n",
    "\n",
    "<table>\n",
    "<tr>\n",
    "    <td><img src=\"images/avatar_mat/奶茶妹1.jpg\" title=\"奶茶妹1.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹2.jpg\" title=\"奶茶妹2.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹3.jpg\" title=\"奶茶妹3.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹4.jpg\" title=\"奶茶妹4.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹5.jpg\" title=\"奶茶妹5.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹6.jpg\" title=\"奶茶妹6.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹7.jpg\" title=\"奶茶妹7.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹8.jpg\" title=\"奶茶妹8.jpg\"></td><td><img src=\"images/avatar_mat/奶茶妹9.jpg\" title=\"奶茶妹9.jpg\"></td>\n",
    "</tr>\n",
    "<tr>\n",
    "<td><img src=\"images/avatar_mat/奶茶弟1.jpg\" title=\"奶茶弟1.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟2.jpg\" title=\"奶茶弟2.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟3.jpg\" title=\"奶茶弟3.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟4.jpg\" title=\"奶茶弟4.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟5.jpg\" title=\"奶茶弟5.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟6.jpg\" title=\"奶茶弟6.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟7.jpg\" title=\"奶茶弟7.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟8.jpg\" title=\"奶茶弟8.jpg\"></td><td><img src=\"images/avatar_mat/奶茶弟9.jpg\" title=\"奶茶弟9.jpg\"></td> \n",
    "</tr>\n",
    "</table>\n",
    "\n",
    "## 2.2 国庆主题素材\n",
    "\n",
    "<table>\n",
    "<tr>\n",
    "   <td><img src=\"images/avatar_mat/五星红旗.png\" title=\"五星红旗.png\"></td> \n",
    "    <td><img src=\"images/avatar_mat/我爱你中国.png\" title=\"我爱你中国.png\"></td> \n",
    "    <td><img src=\"images/avatar_mat/国庆头像背景1.jpg\" title=\"国庆头像背景1.jpg\"></td> \n",
    "    <td><img src=\"images/avatar_mat/国庆头像背景2.jpg\" title=\"国庆头像背景2.jpg\"></td> \n",
    "     <td><img src=\"images/avatar_mat/国庆头像背景3.jpg\" title=\"国庆头像背景3.jpg\"></td> \n",
    "    <td><img src=\"images/avatar_mat/国庆头像背景4.jpg\" title=\"国庆头像背景4.jpg\"></td> \n",
    "     <td><img src=\"images/avatar_mat/国庆头像背景5.jpg\" title=\"国庆头像背景5.jpg\"></td> \n",
    " </tr>\n",
    "</table>\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3. 制作头像的代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 导入包\n",
    "from avatar_utils import gen_avatar_with_flag, gen_avatar_with_cnmap\n",
    "from avatar_utils import gen_avatar_with_gq1, gen_avatar_with_gq2, gen_avatar_with_gq3\n",
    "from avatar_utils import gen_avatar_with_gq4, gen_avatar_with_gq5"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.1 女生国旗头像"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# avatar_file = 奶茶妹1.jpg ~ 奶茶妹9.jpg （更多素材在网盘）\n",
    "# text = 百家姓：王、李、张、刘、陈、杨、赵、黄、周、吴 、网名、小名等等\n",
    "\n",
    "gen_avatar_with_flag(avatar_file=\"奶茶妹1.jpg\", text=\"语嫣\")   # 五星红旗的头像\n",
    "gen_avatar_with_flag(avatar_file=\"奶茶妹2.jpg\", text=\"王语嫣\") # 五星红旗的头像\n",
    "gen_avatar_with_cnmap(avatar_file=\"奶茶妹3.jpg\", text=\"嫣\")    # 我爱你中国地图头像"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.2 男生国旗头像"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# avatar_file=奶茶弟1.jpg ~ 奶茶弟9.jpg（更多素材在网盘）\n",
    "# text = 百家姓：王、李、张、刘、陈、杨、赵、黄、周、吴 、网名、小名等等\n",
    "\n",
    "gen_avatar_with_cnmap(avatar_file=\"奶茶弟1.jpg\", text=\"杨过\")    # 五星红旗的头像\n",
    "gen_avatar_with_flag(avatar_file=\"奶茶弟2.jpg\", text=\"杨大侠\")  # 五星红旗的头像\n",
    "gen_avatar_with_cnmap(avatar_file=\"奶茶弟3.jpg\", text=\"过\")     # 我爱你中国地图头像"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.3 国庆主题头像（只需提供文字）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 国庆主题头像\n",
    "gen_avatar_with_gq1(text=\"刘备\")\n",
    "gen_avatar_with_gq2(text=\"关羽\")\n",
    "gen_avatar_with_gq3(text=\"张飞\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gen_avatar_with_gq4(text=\"曹操\")\n",
    "gen_avatar_with_gq5(text=\"孙权\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.4 文字的控制\n",
    "\n",
    "<br>\n",
    "\n",
    "<font style=\"color:red;font-size:15px\">\n",
    "1. 文字位置：text_pos_offset=(X, Y)， 比如：(-100, -100) <br>\n",
    "2. 文字颜色：font_color=(R ,G, B) 比如：红色 (255,100,100)<br>\n",
    "3. 文字大小：font_size=100 <br>\n",
    "4. 文字横竖：is_horizontal=True|FaLSE 表示文字是否横着排列， True 表示横着排列，False 表示竖着排列。 \n",
    "\n",
    "</font>\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gen_avatar_with_flag(avatar_file=\"奶茶妹3.jpg\", text=\"王语嫣\",\n",
    "                     text_pos_offset=(0,350), font_color=(255,0,0), font_size=250, is_horizontal=True)\n",
    "\n",
    "gen_avatar_with_gq5(text=\"杨过\",\n",
    "                    text_pos_offset=(50,-50), font_color=(200,0,0), font_size=300, is_horizontal=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. 以下网盘有更多的素材\n",
    "\n",
    "\n",
    "<img src=\"images/网盘二维码.jpg\" style=\"width:80%\" align=\"left\"/>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
